javascript find file extension from string

74

javascript find file extension from string -

var ext =  fileName.split('.').pop();

how to get the extension from filename using javascript -

var ext = fileName.substr(fileName.lastIndexOf('.') + 1);

Comments

Submit
0 Comments